<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 
<head>
<%@ include file="../../include/easyui.jsp" %>
<%@ include file="../../include/pGrid.jsp" %>
<script type="text/javascript" src="/plug-in/jquery-easyui-1.5.1/datagrid-detailview.js"></script>
<title>合同管理</title>
<script>
	$(function(){
		p.isTab = true;
		var columns = [[
			{field: 'outContractNo', title: '内部合同编号', width: 130}
			,{field: 'contractNo', title: '合同编号', width: 270}
			,{field: 'contractType', title: '合同类型', width: 80}
			,{field: 'contractLevel', title: '合同级别', width: 100}
			,{field: 'contractName', title: '合同名称', width: 250}
			,{field: 'signYear', title: '年份', width: 60}
			,{field: 'signDate', title: '签订日期', width: 120}
			,{field: 'partA', title: '合同甲方', width: 250}
			,{field: 'partB', title: '合同乙方', width: 250}
			,{field: 'partAuser', title: '甲方经办人', width: 120}
			,{field: 'partAphone', title: '甲方联系电话', width: 120}
			,{field: 'partBuser', title: '乙方经办人', width: 120}
			,{field: 'partBphone', title: '乙方联系电话', width: 120}
			,{field: 'budgetMoney', title: '预算金额', width: 90}
			,{field: 'actualMoney', title: '实际金额', width: 90}
			,{field: 'billMoney', title: '开票金额', width: 90}
			,{field: 'auditMoney', title: '审计金额', width: 90}
			,{field: 'returnedMoney', title: '回款金额', width: 90}
			,{field: 'payDesc', title: '付款情况及说明', width: 130}
			,{field: 'mainUnit', title: '总包单位', width: 180}
			,{field: 'assistUnit', title: '分包单位', width: 180}
			,{field: 'orgNo', title: '所属机构', width: 180,formatter: function(value,row,index){
				return (value || '') + '-' + (row.orgNoName|| '') ;
			}}
			,{field : 'remark',width : 150,title: '备注'}
			,{field: 'createTime', title: '创建时间', width: 180}
			,{field: 'createrName', title: '创建人', width: 180}
		]] ;
		/*列表初始化*/
		var gridParam = {
			queryParams:{
				rightControl: true,//启用数据权限控制
				contractLevel: '子订单',
				contractLevel_searchType:'neq'
			},
			columns : columns,
			autoRowHeight: true,
			singleSelect : true,
			nowrap: true,
			onLoadSuccess: function(){
				p.tooltip(['contractNo' ,  'contractTitle' , 'outContractNo' , 'contractName' ,'partA' ,'partB' ,'partAuser' ,'payDesc' ]);
			}
	};
	p.dataGrid = $(p.dataGrid).datagrid( $.extend({}, p.dataGridParam, gridParam));

		/*事件响应*/
		$("#toolbar .easyui-linkbutton").on("click", function() {
			var id = $(this).attr("motion_code");p.btnOneClick($(this));
			switch (id) {
				case "01":
					p.gridAdd({ title : "合同管理新增", width : 850, height : 430 ,autoMax:true,isTab:true});
					break;
				case "02":
					var row = p.getSelection("请选择一条记录进行编辑");
					if(row){
						p.gridModify({title : "合同管理编辑-"+ row.contractNo ,width : 850, height : 430,autoMax:true });
					}
					break;
				case "03":
					p.gridDelete();
					break;
				case "04":
					var row = p.getSelection("请选择一条记录进行编辑");
					if(row){
						p.gridView({title : "合同管理查看"+ row.contractNo, width : 850, height : 430,autoMax:true });				
					}
					break;
				case "05":
					p.gridQuery();
					break;
				case "07":
		            p.down({filename:'合同管理'});
		         	break;
				case "10":
					var row = p.getSelection();
					if(row){
						p.gridOpt({ title : '合同信息更多'+ row.contractNo,data:row, width : 850, height : 430 ,data: row,href:'/console/contract/config',autoMax:true });
					}
					break;
				case "14"://复制
					var row = p.getSelection('请先选定一条记录再复制!');
					if(row){
						p.gridAdd({ title : '合同记录复制', width : 850, height : 430 ,autoMax:true
							,href:'/console/page?orderId='+ row.id +'&pageName=contract/add'		
						});
					}
					break;
				case "19":
					p.gridAdd({href:'/console/contract/import', title : "合同管理数据导入", width : 550, height : 330 });
					break;
				default:
					break;
			}
		});
	});
</script>
</head>
<body  class="easyui-layout">
		<!-- 但行高度33px，多行时 33乘以行数  -->
		<div id="querybar" data-options="region:'north',split:false,border:false" style="height:auto;">
			<div class="easyui-panel" data-options="fit:true,border:false">
				<!-- 查询条件表单，根据配置进行替换  -->
				<form id="queryForm" >
				 <input type="hidden" name="className" value="com.fs.jzzn.pojo.Contract" />
				 <div style="margin-top:5px;margin-left:10px;float:left;">
				  	<input class="easyui-textbox" name="contractNo" style="width:240px;" data-options="label:'合同编号:',required:false,labelWidth:60,prompt:'合同编号关键词' " />
					<input type="hidden" name="contractNo_searchType" value="like" />
				 </div>
				 <!-- 
				 <div style="margin-top:5px;margin-left:10px;float:left;">
				  	<input class="easyui-textbox" name="contractTitle" style="width:240px;" data-options="label:'订单名称:',required:false,labelWidth:60,prompt:'订单名称关键词' " />
					<input type="hidden" name="contractTitle_searchType" value="like" />
				 </div>
				  -->
				 <div style="margin-top:5px;margin-left:10px;float:left;">
				  	<input class="easyui-textbox" name="contractName" style="width:240px;" data-options="label:'合同名称:',required:false,labelWidth:60,prompt:'合同名称关键词' " />
					<input type="hidden" name="contractName_searchType" value="like" />
				 </div>
				  <div style="margin-top:5px;margin-left:10px;float:left;">
				  	<select class="easyui-combobox" name="signDate" style="width:240px;" data-options="label:'年份:',required:false,labelWidth:60" >
				  		<option value="">==全部==</option>
				  		<option value="2018">2018</option>
				  		<option value="2017">2017</option>
				  		<option value="2016">2016</option>
				  		<option value="2015">2015</option>
				  		<option value="2014">2014</option>
				  		<option value="2013">2013</option>
				  		<option value="2012">2012</option>
				  		<option value="2011">2011</option>
				  	</select>
					<input type="hidden" name="signDate_searchType" value="like" />
				 </div>
				 
				 <div  style="margin-top:5px;margin-left:10px;float:left;">
				 	<input type="hidden" name="orgNo_searchType" value="like" />
				 	<select class="easyui-combotreegrid" id="orgNo_tree" name="orgNo" style="width:240px;" data-options="label:'组织结构:',panelWidth:300,labelWidth:60,
			           	prompt:'请选择组织机构',
			           	idField: 'orgNo', 
						treeField: 'orgName',
						sortName:'orgOrder',
						icons: [{
							iconCls:'icon-remove',
							handler: function(e){
								$(e.data.target).textbox('setValue', '');
							}
						}],
						iconAlign:'right',
						textField:'orgName',
						onSelect:function(row){
							$('#orgNo_tree').combogrid('setText', row.orgName);
						},
						sortOrder:'asc',
			            url:'/console/com.fs.base.pojo.Org/list', 
			            queryParams:{isTreeGrid:'true', treeId:'id', treePid:'parentId' },
			            columns:[[    
			                {field:'orgName',			width:250,	title:'组织名称' }
			            ]]"></select>
				 </div>
				 <div class="fItem">
			  		<input class="easyui-combobox" name="createrId" style="width:240px;" url="/console/combobox?valueField=id&textField=nickName&modleName=user" data-options="label:'创建人:',required:false,labelWidth:60" />
			  		<input type="hidden" name="createrId_searchType" value="eq" />
			 	</div>
			 	
			 	<div class="fItem">
				 	<input class="easyui-datebox" style="width:240px;" name="createTime" data-options="label:'开始日期:',required:false,labelWidth:60" />
				 	<input type="hidden" name="createTime_searchType" value="between" />
				 	<input type="hidden" name="createTime_format" value="date" />
				</div>
				<div class="fItem">
				 	<input class="easyui-datebox" style="width:240px;" name="createTime" data-options="label:'截至日期:',required:false,labelWidth:60" />
				</div>
				
				<div class="fItem">
						<select class="easyui-combobox" name="contractLevel" style="width:240px;" data-options="label:'合同级别:',required:true,labelWidth:60">
					   		<option value="">==不限==</option>
					   		<option value="合同">合同</option>
					   		<option value="框架协议">框架协议</option>
					   	</select>
					   	<input type="hidden" name="contractLevel_searchType" value="eq" />
				</div>
				
				</form>
			</div>
		</div>  
	
		<!-- 工具栏按钮 -->
		<div id="toolbar" class="easyui-panel" style="padding:3px;"></div>
		
		<!-- 表格 -->
		<div region="center" border="false">
			<table id="dataGrid"></table>
		</div>
</body>
</html>